package com.ruyuan.user.server.util;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

/**
 * @author xx
 */
public class PasswordUtil {

    public static String generatePassword(String userName, String password){
        String algorithmName = "MD5";
        int hashIterations = 1024;
        ByteSource credentialsSalt = ByteSource.Util.bytes(userName);
        SimpleHash simpleHash = new SimpleHash(algorithmName, password, credentialsSalt, hashIterations);
        return simpleHash.toString();
    }

}
